<#include "/layout/layout.ftl">
<#import "/layout/macro.ftl" as macro>
<#import "/layout/select.ftl" as my/>
<#assign css>
<#--此ftl中用到的css-->
</#assign>
<#assign js>
<#--此ftl中用到的js-->
<script>
	$(".btn-submit").click(function () {
		// 校验表单合法
		var bootstrapValidator = $(".form-edit").data('bootstrapValidator');
		bootstrapValidator.validate();
		if(bootstrapValidator.isValid()){
			$.ajax({
				type: "POST",
				url: "/weatherCfg/edit",
				data: $(".form-edit").serialize(),
				dataType: "JSON",
				success: function(res){
				    if(res.code != '0'){
                        layer.msg(res.message);
					}else{
                        layer.msg(res.message, {time: 1000
                        }, function(){
                            location.href="/weatherCfg/index";
                        });
					}

				}
			});
		}else{
			return false;
		}
	});

	$('.form-edit').bootstrapValidator({
		message: '请输入有效值',
		feedbackIcons: {
			valid: 'glyphicon glyphicon-ok',
			invalid: 'glyphicon glyphicon-remove',
			validating: 'glyphicon glyphicon-refresh'
		}
	});

</script>
</#assign>
<@layout title="编辑" active="weatherCfg">
<!-- Content Header (Page header) -->
<section class="content-header">
	<h1>
		<#if isAdd>
            新增
        <#else>
            编辑
        </#if>
		<small>特殊天气费用设置</small>
	</h1>
	<ol class="breadcrumb">
		<li><a href="/"><i class="fa fa-home"></i> 管理后台</a></li>
		<li><a href="/weatherCfg/index"><i class="fa fa-list-ul"></i> 特殊天气费用设置列表</a></li>
		<li class="active"><i class="fa fa-edit">特殊天气费用设置新增</i>
		    <#if isAdd>
                新增
            <#else>
                编辑
            </#if>
		</li>
	</ol>
</section>
<!-- Main content -->
<section class="content">
	<div class="row">
		<div class="col-md-12">
			<!-- Default box -->
			<div class="box  box-primary">
				<form class="form-horizontal form-edit" method="post" action="weatherCfg/edit">
					<div class="box-body">
						<input type="hidden" id="id" name="id" value="${weatherCfg.id!}">
						<input type="hidden" id="isAdd" name="isAdd" value="${isAdd?string('true','false')}">
						<div class="form-group">
							<label class="col-sm-2 control-label">特殊天气名称：</label>
							<div class="col-sm-10">
                                <@my.select id="weatherId" datas=getDict('WEATHER') value="${weatherCfg.weatherId!}" defaultValue="请选择特殊天气"/>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">金额：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入金额" id="amt" name="amt" class="form-control" type="text" value="${weatherCfg.amt!}" >
							</div>
						</div>



					<div class="box-footer">
						<button type="button" class="btn btn-default btn-back">返回</button>
						<button type="button" class="btn btn-info pull-right btn-submit">提交</button>
					</div>

				</form>
			</div>
			<!-- /.box -->
		</div>
	</div>
</section>
<!-- /.content -->
</@layout>
